package com.ruoyi.cms.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.cms.domain.CmsSiteBannerr;
import com.ruoyi.cms.service.ICmsSiteBannerrService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 网站开发信息Controller
 * 
 * @author ruoyi
 * @date 2022-08-30
 */
@RestController
@RequestMapping("/cms/bannerr")
public class CmsSiteBannerrController extends BaseController
{
    @Autowired
    private ICmsSiteBannerrService cmsSiteBannerrService;

    /**
     * 查询网站开发信息列表
     */
    @PreAuthorize("@ss.hasPermi('cms:bannerr:list')")
    @GetMapping("/list")
    public TableDataInfo list(CmsSiteBannerr cmsSiteBannerr)
    {
        startPage();
        List<CmsSiteBannerr> list = cmsSiteBannerrService.selectCmsSiteBannerrList(cmsSiteBannerr);
        return getDataTable(list);
    }

    /**
     * 导出网站开发信息列表
     */
    @PreAuthorize("@ss.hasPermi('cms:bannerr:export')")
    @Log(title = "网站开发信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CmsSiteBannerr cmsSiteBannerr)
    {
        List<CmsSiteBannerr> list = cmsSiteBannerrService.selectCmsSiteBannerrList(cmsSiteBannerr);
        ExcelUtil<CmsSiteBannerr> util = new ExcelUtil<CmsSiteBannerr>(CmsSiteBannerr.class);
        util.exportExcel(response, list, "网站开发信息数据");
    }

    /**
     * 获取网站开发信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('cms:bannerr:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(cmsSiteBannerrService.selectCmsSiteBannerrById(id));
    }

    /**
     * 新增网站开发信息
     */
    @PreAuthorize("@ss.hasPermi('cms:bannerr:add')")
    @Log(title = "网站开发信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CmsSiteBannerr cmsSiteBannerr)
    {
        return toAjax(cmsSiteBannerrService.insertCmsSiteBannerr(cmsSiteBannerr));
    }

    /**
     * 修改网站开发信息
     */
    @PreAuthorize("@ss.hasPermi('cms:bannerr:edit')")
    @Log(title = "网站开发信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CmsSiteBannerr cmsSiteBannerr)
    {
        return toAjax(cmsSiteBannerrService.updateCmsSiteBannerr(cmsSiteBannerr));
    }

    /**
     * 删除网站开发信息
     */
    @PreAuthorize("@ss.hasPermi('cms:bannerr:remove')")
    @Log(title = "网站开发信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(cmsSiteBannerrService.deleteCmsSiteBannerrByIds(ids));
    }
}
